/*
* 支付参数通道模型（第四方支付时，直接使用此模型）
* */
class AbsPayParamsChannel {
  /// 本地支付流水号
  final String? outTradeNo;

  /// 支付参数
  final AbsPayParams? param;

  /// 名称
  final String? subject;

  /// 金额
  final String? totalAmount;

  AbsPayParamsChannel({
    this.outTradeNo,
    this.param,
    this.subject,
    this.totalAmount,
  });

  factory AbsPayParamsChannel.fromMap(Map<String, dynamic> json) => AbsPayParamsChannel(
        outTradeNo: json['outTradeNo'],
        subject: json['subject'],
        totalAmount: json['totalAmount'],
        param: json['param'] == null ? null : AbsPayParams.fromMap(json['param']),
      );

  Map<String, dynamic> toMap() => {
        "outTradeNo": outTradeNo,
        "param": param,
        "subject": subject,
        "totalAmount": totalAmount,
      };
}

/*
* 支付参数模型
* */
class AbsPayParams {
  /// 支付宝 v2接口，服务器拼接返回的 link（使用）
  final String? body;

  /// 支付宝 服务器v1返回的属性(暂不使用，目前使用 v2 接口)
  final String? signContent;

  /// 微信支付参数
  final String? timestamp;

  /// 微信支付参数
  final String? noncestr;

  /// 微信支付参数
  final String? prepayid;

  /// 微信支付参数
  final String? appid;

  /// 微信支付参数
  final String? package;

  /// 微信支付参数
  final String? partnerid;

  /// 微信支付参数
  final String? sign;

  AbsPayParams({
    this.body,
    this.signContent,
    this.timestamp,
    this.noncestr,
    this.prepayid,
    this.appid,
    this.package,
    this.partnerid,
    this.sign,
  });

  factory AbsPayParams.fromMap(Map<String, dynamic> json) => AbsPayParams(
        body: json["body"],
        signContent: json['signContent'],
        timestamp: json['timestamp'], // 微信使用
        noncestr: json['noncestr'],
        prepayid: json['prepayid'],
        appid: json['appid'],
        package: json['package'],
        partnerid: json['partnerid'],
        sign: json['sign'],
      );

  Map<String, dynamic> toMap() => {
        "body": body,
        "signContent": signContent,
        "timestamp": timestamp,
        "noncestr": noncestr,
        "prepayid": prepayid,
        "appid": appid,
        "package": package,
        "partnerid": partnerid,
        "sign": sign,
      };
}
